package de.slothsoft.commons.swing.util;

import java.awt.Insets;

import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JToggleButton;

public class SwingUtil {

	// TODO: merge with ControlUtil

	private static final Insets margins = new Insets(0, 0, 0, 0);

	/**
	 * Creates a button for a toolbar (e.g. without margins)
	 * 
	 * @return
	 */

	public static JButton createToolBarButton(Icon icon, String toolTip) {
		JButton result = new JButton(icon);
		result.setMargin(margins);
		result.setToolTipText(toolTip);
		return result;
	}

	/**
	 * Creates a button for a toolbar (e.g. without margins)
	 * 
	 * @return
	 */

	public static JToggleButton createToolBarToggleButton(Icon icon,
			String toolTip) {
		JToggleButton result = new JToggleButton(icon);
		result.setMargin(margins);
		result.setToolTipText(toolTip);
		return result;
	}

}
